package com.atguigu.item.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.vo.SkuDataVo;
import com.atguigu.item.service.SkuDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/api/inner/rpc/item")
public class SkuDataRpcController {
    @Autowired
    private SkuDataService  skuDataService;
    /**
     * 获取商品详情
     * @return
     */
    @GetMapping("/sku/detail/{skuId}")
    public Result<SkuDataVo> getSkuDataVo(@PathVariable("skuId") Long skuId) throws InterruptedException {
         SkuDataVo skuDataVo  = skuDataService.getSkuData(skuId);
         return  Result.ok(skuDataVo);
    }
}
